package com.fen;

import com.fen.bean.Bean1;
import com.fen.bean.Bean3;
import com.fen.config.Bean2Config;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author : lrf
 * @description : 两种加载配置文件方式
 * @tip :
 * @date : 2019/3/20
 */
@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration(locations = {"classpath:application.xml"})
@ContextConfiguration(classes = {Bean2Config.class})
public class SpringDemo01 {


    @Autowired
    private Bean1 bean1;

    @Autowired(required = false) private Bean3 bean3;

    @Test
    public void test(){
        System.out.println("bean1 = " + bean1);

        System.out.println("bean3 = " + bean3);
    }
}
